<template>
	<view>
		<u-grid class="grid" :border="false">
			<u-grid-item class="grid-item" :hoverStyle="false" v-for="(navItem,navIndex) in navlist" :key="navIndex">
				<text class="grid-value" @click="goPage(navItem)">{{navItem.value || 0}} %</text>
				<text class="grid-title">{{navItem.text}}</text>
				<u-icon class="grid-item-icon"  name="info-circle" v-if="navItem.tipsList.length>0"
					@click="clickIcon(navItem)">
				</u-icon>
				<view class="grid-item-info" v-if="navItem.click && navItem.tipsList.length>0">
					<view class="" v-for="(tip,tipIndex) in navItem.tipsList">
						{{tip.text}}：{{tip.value}}
					</view>
				</view>
			</u-grid-item>
		</u-grid>
		<!-- 各种评率 -->
		<view class="ratetips-box" v-for="( rateTip,index) in ratetips" :key="index">
			<view class="ratetips-box-title">
				<text>{{rateTip.title}}</text> <text style="margin-left: 10rpx;"
					:style="{color:rateTip.statusValue==1?'green':'#f00'}">{{rateTip.statusText}}</text>
			</view>
			<u-parse :content="rateTip.content"></u-parse>
		</view>
	</view>
</template>

<script>
	import {
		publicConfig
	} from '@/api'
	export default {
		onLoad() {
			this.loadData()
		},
		onPullDownRefresh() {
			this.loadData()
		},
		data() {
			return {
				navlist: [],
				ratetips: []
			}
		},
		methods: {
			goPage({
				eventtype
			}) {
				if (eventtype) {
					this.nav(`/subpackage/mine/pages/ratetips/list?eventtype=${eventtype}`)
				}
			},
			async loadData() {
				const {
					code,
					data: {
						ratetips,
						navlist
					}
				} = await publicConfig('getRatetips')
				uni.stopPullDownRefresh();
				if (code === 1) {
					this.ratetips = ratetips
					this.navlist = navlist
				}
			},
			clickIcon(item) {
				item.click = !item.click
				this.$forceUpdate()
			}
		}
	}
</script>

<style lang="scss">
	.grid {

		font-size: 28rpx;
		padding: 20rpx 0;
		border: 0.5px solid #eeeeee;

		&-item {
			position: relative;

			&-info {
				background: rgba(0, 0, 0, 0.8);
				color: #fff;
				padding: 20rpx;
				font-size: 24rpx;
				border-radius: 10rpx;
				position: absolute;
				top: 35rpx;
				right: 0;
				z-index: 121;
			}

			&-icon {
				position: absolute;
				top: 0;
				right: 0
			}
		}

		&-title {
			color: $uni-color-primary
		}

		&-value {
			color: #f00;
		}
	}

	.ratetips {
		&-box {
			padding: 20rpx 40rpx;

			&-title {
				font-size: 48rpx;
				font-weight: bold;
			}
		}

	}
</style>